---
title: TrackingTransparency
description: A library for tracking app users and managing tracking permissions.
sourceCodeUrl: 'https://github.com/expo/expo/tree/sdk-54/packages/expo-tracking-transparency'
packageName: 'expo-tracking-transparency'
platforms: ['android', 'ios', 'tvos']
---

import APISection from '~/components/plugins/APISection';
import { APIInstallSection } from '~/components/plugins/InstallSection';
import { IOSPermissions } from '~/components/plugins/permissions';
import {
  ConfigReactNative,
  ConfigPluginExample,
  ConfigPluginProperties,
} from '~/ui/components/ConfigSection';
import { SnackInline } from '~/ui/components/Snippet';

A library for tracking app users and managing tracking permissions. Provides access to advertising identifiers and manages the required permissions for tracking. Examples of data used for tracking include email address, device ID, advertising ID, and more. If the "Allow Apps to Request to Track" device-level setting is off, this permission will be denied. Be sure to add `NSUserTrackingUsageDescription` to your [**Info.plist**](../config/app/#infoplist) to explain how the user will be tracked. Otherwise, your app will be rejected by Apple.

For more information on Apple's App Tracking Transparency framework, see their [documentation](https://developer.apple.com/app-store/user-privacy-and-data-use/).

## Installation

<APIInstallSection />

## Configuration in app config

You can configure `expo-tracking-transparency` using its built-in [config plugin](/config-plugins/introduction/) if you use config plugins in your project ([Continuous Native Generation (CNG)](/workflow/continuous-native-generation/)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does **not** use CNG, then you'll need to manually configure the library.

<ConfigPluginExample>

```json app.json
{
  "expo": {
    "plugins": [
      [
        "expo-tracking-transparency",
        {
          "userTrackingPermission": "This identifier will be used to deliver personalized ads to you."
        }
      ]
    ]
  }
}
```

</ConfigPluginExample>

<ConfigPluginProperties
  properties={[
    {
      name: 'userTrackingPermission',
      platform: 'ios',
      description:
        'Sets the iOS `NSUserTrackingUsageDescription` permission message in **Info.plist**.',
      default:
        '"Allow this app to collect app-related data that can be used for tracking you or your device."',
    },
  ]}
/>

<ConfigReactNative>

If you're not using Continuous Native Generation ([CNG](/workflow/continuous-native-generation/)) (you're using native **android** and **ios** projects manually), then you need to configure following permissions in your native projects:

- For Android, add `com.google.android.gms.permission.AD_ID` permission to your project's **android/app/src/main/AndroidManifest.xml**.

  ```xml
  <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
  ```

- For iOS, add `NSUserTrackingUsageDescription` key to your project's **ios/[app]/Info.plist**:

  ```xml
  <key>NSUserTrackingUsageDescription</key>
  <string>Your custom usage description string here.</string>
  ```

</ConfigReactNative>

## Usage

<SnackInline label='Basic tracking transparency usage' dependencies={['expo-tracking-transparency']}>

```jsx
import { useEffect } from 'react';
import { Text, StyleSheet, View } from 'react-native';
import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';

export default function App() {
  useEffect(() => {
    (async () => {
      const { status } = await requestTrackingPermissionsAsync();
      if (status === 'granted') {
        console.log('Yay! I have user permission to track data');
      }
    })();
  }, []);

  return (
    <View style={styles.container}>
      <Text>Tracking Transparency Module Example</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

</SnackInline>

## API

```ts
import * as ExpoTrackingTransparency from 'expo-tracking-transparency';
```

<APISection packageName="expo-tracking-transparency" />

## Permissions

### Android

The following permissions are added automatically through the library's **AndroidManifest.xml**.

| Android Permission                        | Description                                                                                                                                                                    |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `com.google.android.gms.permission.AD_ID` | Allows access to the Advertising ID for tracking and analytics. Required for apps targeting Android 13 (API level 33) or higher that use Google Play services' Advertising ID. |

### iOS

The following usage description keys are used by this library:

<IOSPermissions permissions={['NSUserTrackingUsageDescription']} />
````
